import Vue from "vue";
import Vuex from "vuex";

Vue.use(Vuex);

export default new Vuex.Store({
  state: {
    token: localStorage.token || "",
    refresh_token: localStorage.refresh_token || "",
  },
  mutations: {
    saveToken(state, obj) {
      state.token = obj.token;
      state.refresh_token = obj.refresh_token;
      localStorage.token = obj.token;
      localStorage.refresh_token = obj.refresh_token;
    },
  },
  actions: {},
  modules: {},
});
